/*
 * Copyright 2016-2019 yoara
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package yhao.infra.apilist.validate;

import io.swagger.annotations.ApiModelProperty;
import yhao.infra.apilist.ValidationForm;

import java.util.List;


/**
 * 数据权限基类form
 * <p>数据权限是指一类从属于某个组织或个人的数据，想要理解并使用数据权限，首先要理解组织、组织代码(也称之为编码)、人员之间的关系。
 * yhao架构通过erp demo工程定义的了一个简易版的数据结构。
 * <p>每种需要区别数据权限的数据集合，在定义表结构时需要存储组织Id和人员Id，通过登录人的datas（组织代码集合）数据关联出匹配组织id的数据记录。
 * <p>在infra-service-base中将详细描述
 *
 * @author yoara
 */
public class DataAuthForm implements ValidationForm {
    @ApiModelProperty(value = "是否为当前组织管理层",hidden = true)
    private boolean orgManager;

    @ApiModelProperty(value = "指定数据类型可用的数据组织长编码",hidden = true)
    private List<String> datas;

    @ApiModelProperty(value = "数据权限：当前人员组织长编码",hidden = true)
    private String personOrgLongNumber;

    @ApiModelProperty(value = "数据权限：当前人员ID",hidden = true)
    private String personId;


    /*********** 下列为可能的自定义字段 ************/
    @ApiModelProperty(value = "数据权限：拥有人字段名",hidden = true)
    private String managerColumnName = "fcreate_operator_id";

    @ApiModelProperty(value = "数据权限：拥有组织字段名",hidden = true)
    private String orgColumnName = "forg_id";

    @ApiModelProperty(value = "数据权限：erp所在库名",hidden = true)
    private String erpDbName;

    @ApiModelProperty(value = "数据权限：erp组织表名",hidden = true)
    private String erpOrgTableName = "t_erp_org";

    @ApiModelProperty(value = "数据权限：数据记录别称",hidden = true)
    private String dataAuthRecord = "data_auth_record";

    public boolean isOrgManager() {
        return orgManager;
    }

    public void setOrgManager(boolean orgManager) {
        this.orgManager = orgManager;
    }

    public List<String> getDatas() {
        return datas;
    }

    public void setDatas(List<String> datas) {
        this.datas = datas;
    }

    public String getPersonOrgLongNumber() {
        return personOrgLongNumber;
    }

    public void setPersonOrgLongNumber(String personOrgLongNumber) {
        this.personOrgLongNumber = personOrgLongNumber;
    }

    public String getPersonId() {
        return personId;
    }

    public void setPersonId(String personId) {
        this.personId = personId;
    }

    public String getManagerColumnName() {
        return managerColumnName;
    }

    public void renameManagerColumn(String managerColumnName) {
        this.managerColumnName = managerColumnName;
    }

    public String getOrgColumnName() {
        return orgColumnName;
    }

    public void renameOrgColumnName(String orgColumnName) {
        this.orgColumnName = orgColumnName;
    }

    public String getErpDbName() {
        return erpDbName;
    }

    public void setErpDbName(String erpDbName) {
        this.erpDbName = erpDbName;
    }

    public void setManagerColumnName(String managerColumnName) {
        this.managerColumnName = managerColumnName;
    }

    public void setOrgColumnName(String orgColumnName) {
        this.orgColumnName = orgColumnName;
    }

    public String getErpOrgTableName() {
        return erpOrgTableName;
    }

    public void setErpOrgTableName(String erpOrgTableName) {
        this.erpOrgTableName = erpOrgTableName;
    }

    public String getDataAuthRecord() {
        return dataAuthRecord;
    }

    public void setDataAuthRecord(String dataAuthRecord) {
        this.dataAuthRecord = dataAuthRecord;
    }
}
